  package com.e2e.haiti.infrastructure.surveyor;

  import com.actionbarsherlock.app.SherlockFragment;
import com.e2e.haiti.infrastructure.surveyor.R;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

public class FragmentSecondaryQuestionnaire extends SherlockFragment {
	
    private Utils utilsHelper = null;
    private Cursor structureCursor = null;
    private int structureID;
	
    private EditText EditText_PermanentInteriorPartitionsNote = null;
    private EditText EditText_SemiPermanentInteriorPartitionsNote = null;
    private EditText EditText_FoundationNote = null;
    private EditText EditText_FoundationConstructionMaterialNote = null;
    private EditText EditText_RoofSystemTypeNote = null;
    private EditText EditText_ConstructionMaterialFloor1Note = null;
    private EditText EditText_ConstructionMaterialFloor2Note = null;
    private EditText EditText_ConstructionMaterialFloor3Note = null;
    private EditText EditText_ConstructionMaterialFloor4Note = null;
    private EditText EditText_ConstructionMaterialFloor5Note = null;
    
    private CheckBox CheckBox_PermanentInteriorPartitions_Masonry = null;
    private CheckBox CheckBox_PermanentInteriorPartitions_Stone = null;
    private CheckBox CheckBox_PermanentInteriorPartitions_Earth = null;
    private CheckBox CheckBox_PermanentInteriorPartitions_Wood = null;
    private CheckBox CheckBox_PermanentInteriorPartitions_Metal = null;
    private CheckBox CheckBox_PermanentInteriorPartitions_Other = null;
    private CheckBox CheckBox_SemiPermanentInteriorPartitions_Wood = null;
    private CheckBox CheckBox_SemiPermanentInteriorPartitions_Canvas = null;
    private CheckBox CheckBox_SemiPermanentInteriorPartitions_Other = null;
    private CheckBox CheckBox_Foundation_None = null;
    private CheckBox CheckBox_Foundation_Mat = null;
    private CheckBox CheckBox_Foundation_Footings = null;
    private CheckBox CheckBox_Foundation_ShallowFoundation = null;
    private CheckBox CheckBox_Foundation_DeepFoundation = null;
    private CheckBox CheckBox_Foundation_ElevatedOnPiles = null;
    private CheckBox CheckBox_Foundation_Other = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_NA = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_Masonry = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_Stone = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_CastConcrete = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_Wood = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_Metal = null;
    private CheckBox CheckBox_FoundationSystem_ConstructionMaterial_Other = null;
    private CheckBox CheckBox_RoofSystem_ConcreteSlab = null;
    private CheckBox CheckBox_RoofSystem_Framed = null;
    private CheckBox CheckBox_RoofSystem_Other = null;
    private CheckBox CheckBox_ConcreteSlabRoofDetails_MasonryPresence = null;
    private CheckBox CheckBox_FramedRoofDetails_MetalFraming = null;
    private CheckBox CheckBox_FramedRoofDetails_WoodFraming = null;
    private CheckBox CheckBox_FramedRoofDetails_MetalCovering = null;
    private CheckBox CheckBox_FramedRoofDetails_WoodCovering = null;
    private CheckBox CheckBox_FramedRoofDetails_ThatchCovering = null;
    private CheckBox CheckBox_FramedRoofDetails_CanvasCovering = null;
    private CheckBox CheckBox_FramedRoofDetails_Tiles = null;
    private CheckBox CheckBox_FramedRoofDetails_Shingles = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_NA = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_Masonry = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_Stone = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_CastConcrete = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_Wood = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_Metal = null;
    private CheckBox CheckBox_ConstructionMaterialFloor1_Other = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_NA = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_Masonry = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_Stone = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_CastConcrete = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_Wood = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_Metal = null;
    private CheckBox CheckBox_ConstructionMaterialFloor2_Other = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_NA = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_Masonry = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_Stone = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_CastConcrete = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_Wood = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_Metal = null;
    private CheckBox CheckBox_ConstructionMaterialFloor3_Other = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_NA = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_Masonry = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_Stone = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_CastConcrete = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_Wood = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_Metal = null;
    private CheckBox CheckBox_ConstructionMaterialFloor4_Other = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_NA = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_Masonry = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_Stone = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_CastConcrete = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_Wood = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_Metal = null;
    private CheckBox CheckBox_ConstructionMaterialFloor5_Other = null; 
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
                
        utilsHelper = new Utils(getActivity().getApplicationContext());              
                 
    } // end of the onCreate method
    
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
    	
    	// Sets the cursor
    	setStructureCursor();  
    	
    	View fragmentView = inflater.inflate(R.layout.secondary_questionnaire_layout, container, false);
    	manageFormFields(fragmentView);
    	
    	return fragmentView;
    }
    
    private void setStructureCursor(){
        utilsHelper.openDatabase(); 
   	   // Get structure ID
          structureID = getActivity().getIntent().getIntExtra("structureID", -1); //Get structureID otherwise -1      
          structureCursor = utilsHelper.getStructureCursor(structureID); 
          utilsHelper.closeDatabase(); 
      }    
    
    private void manageFormFields(View v){
    	
    	// Declares the text input fields
        EditText_PermanentInteriorPartitionsNote = (EditText) v.findViewById(R.id.Secondary_editText_PermanentInteriorPartitionsNote); 
        EditText_SemiPermanentInteriorPartitionsNote = (EditText) v.findViewById(R.id.Secondary_editText_SemiPermanentInteriorPartitionsNote); 
        EditText_FoundationNote = (EditText) v.findViewById(R.id.Secondary_editText_FoundationNote);
        EditText_FoundationConstructionMaterialNote =(EditText) v.findViewById(R.id.Secondary_editText_FoundationConstructionMaterialNote);
        EditText_RoofSystemTypeNote = (EditText) v.findViewById(R.id.Secondary_editText_RoofSystemTypeNote); 
        EditText_ConstructionMaterialFloor1Note = (EditText) v.findViewById(R.id.Secondary_editText_ConstructionMaterialFloor1Note); 
        EditText_ConstructionMaterialFloor2Note = (EditText) v.findViewById(R.id.Secondary_editText_ConstructionMaterialFloor2Note);
        EditText_ConstructionMaterialFloor3Note = (EditText) v.findViewById(R.id.Secondary_editText_ConstructionMaterialFloor3Note); 
        EditText_ConstructionMaterialFloor4Note = (EditText) v.findViewById(R.id.Secondary_editText_ConstructionMaterialFloor4Note);
        EditText_ConstructionMaterialFloor5Note = (EditText) v.findViewById(R.id.Secondary_editText_ConstructionMaterialFloor5Note); 
        
    	// Declares the check box fields
        CheckBox_PermanentInteriorPartitions_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_PermanentInteriorPartitions_Masonry);
        CheckBox_PermanentInteriorPartitions_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_PermanentInteriorPartitions_Stone);
        CheckBox_PermanentInteriorPartitions_Earth = (CheckBox) v.findViewById(R.id.Secondary_checkBox_PermanentInteriorPartitions_Earth);
        CheckBox_PermanentInteriorPartitions_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_PermanentInteriorPartitions_Wood);
        CheckBox_PermanentInteriorPartitions_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_PermanentInteriorPartitions_Metal);
        CheckBox_PermanentInteriorPartitions_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_PermanentInteriorPartitions_Other);
        CheckBox_SemiPermanentInteriorPartitions_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_SemiPermanentInteriorPartitions_Wood);
        CheckBox_SemiPermanentInteriorPartitions_Canvas = (CheckBox) v.findViewById(R.id.Secondary_checkBox_SemiPermanentInteriorPartitions_Canvas);
        CheckBox_SemiPermanentInteriorPartitions_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_SemiPermanentInteriorPartitions_Other);
        CheckBox_Foundation_None = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_None);
        CheckBox_Foundation_Mat = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_Mat);
        CheckBox_Foundation_Footings = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_Footings);
        CheckBox_Foundation_ShallowFoundation = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_ShallowFoundation);
        CheckBox_Foundation_DeepFoundation = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_DeepFoundation);
        CheckBox_Foundation_ElevatedOnPiles = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_ElevatedOnPiles);
        CheckBox_Foundation_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_Foundation_Other);
        CheckBox_FoundationSystem_ConstructionMaterial_NA= (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_NA);
        CheckBox_FoundationSystem_ConstructionMaterial_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_Masonry);
        CheckBox_FoundationSystem_ConstructionMaterial_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_Stone);
        CheckBox_FoundationSystem_ConstructionMaterial_CastConcrete = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_CastConcrete);
        CheckBox_FoundationSystem_ConstructionMaterial_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_Wood);
        CheckBox_FoundationSystem_ConstructionMaterial_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_Metal);
        CheckBox_FoundationSystem_ConstructionMaterial_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FoundationConstructionMaterial_Other);
        CheckBox_RoofSystem_ConcreteSlab = (CheckBox) v.findViewById(R.id.Secondary_checkBox_RoofSystem_ConcreteSlab);
        CheckBox_RoofSystem_Framed = (CheckBox) v.findViewById(R.id.Secondary_checkBox_RoofSystem_Framed);
        CheckBox_RoofSystem_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_RoofSystem_Other);
        CheckBox_ConcreteSlabRoofDetails_MasonryPresence = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConcreteSlabRoofDetails_MasonryPresence);
        CheckBox_FramedRoofDetails_MetalFraming = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_MetalFraming);
        CheckBox_FramedRoofDetails_WoodFraming = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_WoodFraming);
        CheckBox_FramedRoofDetails_MetalCovering = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_MetalCovering);
        CheckBox_FramedRoofDetails_WoodCovering = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_WoodCovering);
        CheckBox_FramedRoofDetails_ThatchCovering = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_ThatchCovering);
        CheckBox_FramedRoofDetails_CanvasCovering = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_CanvasCovering);
        CheckBox_FramedRoofDetails_Tiles = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_Tiles);
        CheckBox_FramedRoofDetails_Shingles = (CheckBox) v.findViewById(R.id.Secondary_checkBox_FramedRoofDetails_Shingles);
        CheckBox_ConstructionMaterialFloor1_NA = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_NA);
        CheckBox_ConstructionMaterialFloor1_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_Masonry);
        CheckBox_ConstructionMaterialFloor1_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_Stone);
        CheckBox_ConstructionMaterialFloor1_CastConcrete = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_CastConcrete);
        CheckBox_ConstructionMaterialFloor1_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_Wood);
        CheckBox_ConstructionMaterialFloor1_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_Metal);
        CheckBox_ConstructionMaterialFloor1_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor1_Other);
        CheckBox_ConstructionMaterialFloor2_NA = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_NA);
        CheckBox_ConstructionMaterialFloor2_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_Masonry);
        CheckBox_ConstructionMaterialFloor2_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_Stone);
        CheckBox_ConstructionMaterialFloor2_CastConcrete = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_CastConcrete);
        CheckBox_ConstructionMaterialFloor2_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_Wood);
        CheckBox_ConstructionMaterialFloor2_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_Metal);
        CheckBox_ConstructionMaterialFloor2_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor2_Other);
        CheckBox_ConstructionMaterialFloor3_NA = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_NA);
        CheckBox_ConstructionMaterialFloor3_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_Masonry);
        CheckBox_ConstructionMaterialFloor3_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_Stone);
        CheckBox_ConstructionMaterialFloor3_CastConcrete = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_CastConcrete);
        CheckBox_ConstructionMaterialFloor3_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_Wood);
        CheckBox_ConstructionMaterialFloor3_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_Metal);
        CheckBox_ConstructionMaterialFloor3_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor3_Other);
        CheckBox_ConstructionMaterialFloor4_NA = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_NA);
        CheckBox_ConstructionMaterialFloor4_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_Masonry);
        CheckBox_ConstructionMaterialFloor4_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_Stone);
        CheckBox_ConstructionMaterialFloor4_CastConcrete = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_CastConcrete);
        CheckBox_ConstructionMaterialFloor4_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_Wood);
        CheckBox_ConstructionMaterialFloor4_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_Metal);
        CheckBox_ConstructionMaterialFloor4_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor4_Other);
        CheckBox_ConstructionMaterialFloor5_NA = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_NA);
        CheckBox_ConstructionMaterialFloor5_Masonry = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_Masonry);
        CheckBox_ConstructionMaterialFloor5_Stone = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_Stone);
        CheckBox_ConstructionMaterialFloor5_CastConcrete = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_CastConcrete);
        CheckBox_ConstructionMaterialFloor5_Wood = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_Wood);
        CheckBox_ConstructionMaterialFloor5_Metal = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_Metal);
        CheckBox_ConstructionMaterialFloor5_Other = (CheckBox) v.findViewById(R.id.Secondary_checkBox_ConstructionMaterialFloor5_Other);

        // Checks if data already exists in Edit Text fields
		String PermanentInteriorPartitionsNote = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_NOTE));
		String SemiPermanentInteriorPartitionsNote = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_NOTE));
		String FoundationNote = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_NOTE));
        String FoundationConstructionMaterialNote = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_NOTE));
		String RoofSystemTypeNote = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_NOTE));
		String ConstructionMaterialFloor1Note= structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_NOTE));
		String ConstructionMaterialFloor2Note = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_NOTE));
		String ConstructionMaterialFloor3Note = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_NOTE));
		String ConstructionMaterialFloor4Note = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_NOTE));
		String ConstructionMaterialFloor5Note = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_NOTE));
		
        // Checks if data already exists for Check Box fields

		Boolean	PermanentInteriorPartitions_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_MASONRY))); 
		Boolean	PermanentInteriorPartitions_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_STONE)));
		Boolean	PermanentInteriorPartitions_Earth = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_EARTH))); 
		Boolean	PermanentInteriorPartitions_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_WOOD)));
		Boolean	PermanentInteriorPartitions_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_METAL)));
		Boolean	PermanentInteriorPartitions_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_OTHER)));
		Boolean	SemiPermanentInteriorPartitions_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_WOOD)));
		Boolean	SemiPermanentInteriorPartitions_Canvas = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_CANVAS)));
		Boolean	SemiPermanentInteriorPartitions_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_OTHER)));
		Boolean	Foundation_None = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_NONE)));
		Boolean	Foundation_Mat = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_MAT)));
		Boolean	Foundation_Footings = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_FOOTINGS)));
		Boolean	Foundation_ShallowFoundation = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_SHALLOW_FOUNDATION)));
		Boolean	Foundation_DeepFoundation = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_DEEP_FOUNDATION))); 
		Boolean	Foundation_ElevatedOnPiles = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_ELEVATED_ON_PILES))); 
		Boolean	Foundation_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_OTHER))); 
		Boolean	FoundationConstructionMaterial_NA = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_NA))); 
		Boolean	FoundationConstructionMaterial_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_MASONRY)));
		Boolean	FoundationConstructionMaterial_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_STONE)));
		Boolean	FoundationConstructionMaterial_CastConcrete = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_CAST_CONCRETE)));
		Boolean	FoundationConstructionMaterial_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_WOOD)));
		Boolean	FoundationConstructionMaterial_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_METAL)));
		Boolean	FoundationConstructionMaterial_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_OTHER)));
		Boolean	RoofSystem_ConcreteSlab = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_CONCRETE_SLAB)));
		Boolean	RoofSystem_Framed = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_FRAMED)));
		Boolean	RoofSystem_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_OTHER)));
		Boolean	ConcreteSlabRoofDetails_MasonryPresence = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_CONCRETE_SLAB_ROOF_PRESENCE_OF_MASONRY)));
		Boolean	FramedRoofDetails_MetalFraming = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_METAL_FRAMING)));
		Boolean	FramedRoofDetails_WoodFraming = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_WOOD_FRAMING)));
		Boolean	FramedRoofDetails_MetalCovering = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_METAL_COVERING)));
		Boolean	FramedRoofDetails_WoodCovering = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_WOOD_COVERING)));
		Boolean	FramedRoofDetails_ThatchCovering = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_THATCH_COVERING)));
		Boolean	FramedRoofDetails_CanvasCovering = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_CANVAS_COVERING)));
		Boolean	FramedRoofDetails_Tiles = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_TILES)));
		Boolean	FramedRoofDetails_Shingles = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_SHINGLES)));
		Boolean	ConstructionMaterialFloor1_NA = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_NA))); 
		Boolean	ConstructionMaterialFloor1_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_MASONRY))); 
		Boolean	ConstructionMaterialFloor1_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_STONE))); 
		Boolean	ConstructionMaterialFloor1_CastConcrete = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_CAST_CONCRETE))); 
		Boolean	ConstructionMaterialFloor1_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_WOOD))); 
		Boolean	ConstructionMaterialFloor1_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_METAL))); 
		Boolean	ConstructionMaterialFloor1_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_OTHER))); 
		Boolean	ConstructionMaterialFloor2_NA = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_NA))); 
		Boolean	ConstructionMaterialFloor2_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_MASONRY))); 
		Boolean	ConstructionMaterialFloor2_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_STONE))); 
		Boolean	ConstructionMaterialFloor2_CastConcrete = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_CAST_CONCRETE))); 
		Boolean	ConstructionMaterialFloor2_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_WOOD))); 
		Boolean	ConstructionMaterialFloor2_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_METAL))); 
		Boolean	ConstructionMaterialFloor2_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_OTHER))); 
		Boolean	ConstructionMaterialFloor3_NA = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_NA))); 
		Boolean	ConstructionMaterialFloor3_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_MASONRY))); 
		Boolean	ConstructionMaterialFloor3_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_STONE))); 
		Boolean	ConstructionMaterialFloor3_CastConcrete = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_CAST_CONCRETE))); 
		Boolean	ConstructionMaterialFloor3_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_WOOD))); 
		Boolean	ConstructionMaterialFloor3_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_METAL)));
		Boolean	ConstructionMaterialFloor3_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_OTHER)));
		Boolean	ConstructionMaterialFloor4_NA = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_NA)));
		Boolean	ConstructionMaterialFloor4_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_MASONRY)));
		Boolean	ConstructionMaterialFloor4_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_STONE)));
		Boolean	ConstructionMaterialFloor4_CastConcrete = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_CAST_CONCRETE)));
		Boolean	ConstructionMaterialFloor4_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_WOOD)));
		Boolean	ConstructionMaterialFloor4_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_METAL)));
		Boolean	ConstructionMaterialFloor4_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_OTHER)));
		Boolean	ConstructionMaterialFloor5_NA = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_NA))); 
		Boolean	ConstructionMaterialFloor5_Masonry = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_MASONRY)));
		Boolean	ConstructionMaterialFloor5_Stone = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_STONE)));
		Boolean	ConstructionMaterialFloor5_CastConcrete = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_CAST_CONCRETE)));
		Boolean	ConstructionMaterialFloor5_Wood = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_WOOD))); 
		Boolean	ConstructionMaterialFloor5_Metal = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_METAL)));
		Boolean	ConstructionMaterialFloor5_Other = stringToBool(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_OTHER)));
		
	// Sets the text of the input fields
		
        EditText_PermanentInteriorPartitionsNote.setText(PermanentInteriorPartitionsNote);
        EditText_SemiPermanentInteriorPartitionsNote.setText(SemiPermanentInteriorPartitionsNote);
        EditText_FoundationNote.setText(FoundationNote);
        EditText_FoundationConstructionMaterialNote.setText(FoundationConstructionMaterialNote);
        EditText_RoofSystemTypeNote.setText(RoofSystemTypeNote);
        EditText_ConstructionMaterialFloor1Note.setText(ConstructionMaterialFloor1Note); 
        EditText_ConstructionMaterialFloor2Note.setText(ConstructionMaterialFloor2Note);
        EditText_ConstructionMaterialFloor3Note.setText(ConstructionMaterialFloor3Note);
        EditText_ConstructionMaterialFloor4Note.setText(ConstructionMaterialFloor4Note);
        EditText_ConstructionMaterialFloor5Note.setText(ConstructionMaterialFloor5Note);

     // Sets the value of the Check Boxes
        CheckBox_PermanentInteriorPartitions_Masonry.setChecked(PermanentInteriorPartitions_Masonry);
        CheckBox_PermanentInteriorPartitions_Stone.setChecked(PermanentInteriorPartitions_Stone);
        CheckBox_PermanentInteriorPartitions_Earth.setChecked(PermanentInteriorPartitions_Earth);
        CheckBox_PermanentInteriorPartitions_Wood.setChecked(PermanentInteriorPartitions_Wood);
        CheckBox_PermanentInteriorPartitions_Metal.setChecked(PermanentInteriorPartitions_Metal);
        CheckBox_PermanentInteriorPartitions_Other.setChecked(PermanentInteriorPartitions_Other);
        CheckBox_SemiPermanentInteriorPartitions_Wood.setChecked(SemiPermanentInteriorPartitions_Wood);
        CheckBox_SemiPermanentInteriorPartitions_Canvas.setChecked(SemiPermanentInteriorPartitions_Canvas);
        CheckBox_SemiPermanentInteriorPartitions_Other.setChecked(SemiPermanentInteriorPartitions_Other);
        CheckBox_Foundation_None.setChecked(Foundation_None);
        CheckBox_Foundation_Mat.setChecked(Foundation_Mat);
        CheckBox_Foundation_Footings.setChecked(Foundation_Footings);
        CheckBox_Foundation_ShallowFoundation.setChecked(Foundation_ShallowFoundation);
        CheckBox_Foundation_DeepFoundation.setChecked(Foundation_DeepFoundation);
        CheckBox_Foundation_ElevatedOnPiles.setChecked(Foundation_ElevatedOnPiles);
        CheckBox_Foundation_Other.setChecked(Foundation_Other);
        CheckBox_FoundationSystem_ConstructionMaterial_NA.setChecked(FoundationConstructionMaterial_NA);
        CheckBox_FoundationSystem_ConstructionMaterial_Masonry.setChecked(FoundationConstructionMaterial_Masonry);
        CheckBox_FoundationSystem_ConstructionMaterial_Stone.setChecked(FoundationConstructionMaterial_Stone);
        CheckBox_FoundationSystem_ConstructionMaterial_CastConcrete.setChecked(FoundationConstructionMaterial_CastConcrete);
        CheckBox_FoundationSystem_ConstructionMaterial_Wood.setChecked(FoundationConstructionMaterial_Wood);
        CheckBox_FoundationSystem_ConstructionMaterial_Metal.setChecked(FoundationConstructionMaterial_Metal);
        CheckBox_FoundationSystem_ConstructionMaterial_Other.setChecked(FoundationConstructionMaterial_Other);
        CheckBox_RoofSystem_ConcreteSlab.setChecked(RoofSystem_ConcreteSlab);
        CheckBox_RoofSystem_Framed.setChecked(RoofSystem_Framed);
        CheckBox_RoofSystem_Other.setChecked(RoofSystem_Other);
        CheckBox_ConcreteSlabRoofDetails_MasonryPresence.setChecked(ConcreteSlabRoofDetails_MasonryPresence);
        CheckBox_FramedRoofDetails_MetalFraming.setChecked(FramedRoofDetails_MetalFraming);
        CheckBox_FramedRoofDetails_WoodFraming.setChecked(FramedRoofDetails_WoodFraming);
        CheckBox_FramedRoofDetails_MetalCovering.setChecked(FramedRoofDetails_MetalCovering);
        CheckBox_FramedRoofDetails_WoodCovering.setChecked(FramedRoofDetails_WoodCovering);
        CheckBox_FramedRoofDetails_ThatchCovering.setChecked(FramedRoofDetails_ThatchCovering);
        CheckBox_FramedRoofDetails_CanvasCovering.setChecked(FramedRoofDetails_CanvasCovering);
        CheckBox_FramedRoofDetails_Tiles.setChecked(FramedRoofDetails_Tiles);
        CheckBox_FramedRoofDetails_Shingles.setChecked(FramedRoofDetails_Shingles);
        CheckBox_ConstructionMaterialFloor1_NA.setChecked(ConstructionMaterialFloor1_NA);
        CheckBox_ConstructionMaterialFloor1_Masonry.setChecked(ConstructionMaterialFloor1_Masonry);
        CheckBox_ConstructionMaterialFloor1_Stone.setChecked(ConstructionMaterialFloor1_Stone);
        CheckBox_ConstructionMaterialFloor1_CastConcrete.setChecked(ConstructionMaterialFloor1_CastConcrete);
        CheckBox_ConstructionMaterialFloor1_Wood.setChecked(ConstructionMaterialFloor1_Wood);
        CheckBox_ConstructionMaterialFloor1_Metal.setChecked(ConstructionMaterialFloor1_Metal);
        CheckBox_ConstructionMaterialFloor1_Other.setChecked(ConstructionMaterialFloor1_Other);
        CheckBox_ConstructionMaterialFloor2_NA.setChecked(ConstructionMaterialFloor2_NA);
        CheckBox_ConstructionMaterialFloor2_Masonry.setChecked(ConstructionMaterialFloor2_Masonry);
        CheckBox_ConstructionMaterialFloor2_Stone.setChecked(ConstructionMaterialFloor2_Stone);
        CheckBox_ConstructionMaterialFloor2_CastConcrete.setChecked(ConstructionMaterialFloor2_CastConcrete);
        CheckBox_ConstructionMaterialFloor2_Wood.setChecked(ConstructionMaterialFloor2_Wood);
        CheckBox_ConstructionMaterialFloor2_Metal.setChecked(ConstructionMaterialFloor2_Metal);
        CheckBox_ConstructionMaterialFloor2_Other.setChecked(ConstructionMaterialFloor2_Other);
        CheckBox_ConstructionMaterialFloor3_NA.setChecked(ConstructionMaterialFloor3_NA);
        CheckBox_ConstructionMaterialFloor3_Masonry.setChecked(ConstructionMaterialFloor3_Masonry);
        CheckBox_ConstructionMaterialFloor3_Stone.setChecked(ConstructionMaterialFloor3_Stone);
        CheckBox_ConstructionMaterialFloor3_CastConcrete.setChecked(ConstructionMaterialFloor3_CastConcrete);
        CheckBox_ConstructionMaterialFloor3_Wood.setChecked(ConstructionMaterialFloor3_Wood);
        CheckBox_ConstructionMaterialFloor3_Metal.setChecked(ConstructionMaterialFloor3_Metal);
        CheckBox_ConstructionMaterialFloor3_Other.setChecked(ConstructionMaterialFloor3_Other);
        CheckBox_ConstructionMaterialFloor4_NA.setChecked(ConstructionMaterialFloor4_NA);
        CheckBox_ConstructionMaterialFloor4_Masonry.setChecked(ConstructionMaterialFloor4_Masonry);
        CheckBox_ConstructionMaterialFloor4_Stone.setChecked(ConstructionMaterialFloor4_Stone);
        CheckBox_ConstructionMaterialFloor4_CastConcrete.setChecked(ConstructionMaterialFloor4_CastConcrete);
        CheckBox_ConstructionMaterialFloor4_Wood.setChecked(ConstructionMaterialFloor4_Wood);
        CheckBox_ConstructionMaterialFloor4_Metal.setChecked(ConstructionMaterialFloor4_Metal);
        CheckBox_ConstructionMaterialFloor4_Other.setChecked(ConstructionMaterialFloor4_Other);
        CheckBox_ConstructionMaterialFloor5_NA.setChecked(ConstructionMaterialFloor5_NA);
        CheckBox_ConstructionMaterialFloor5_Masonry.setChecked(ConstructionMaterialFloor5_Masonry);
        CheckBox_ConstructionMaterialFloor5_Stone.setChecked(ConstructionMaterialFloor5_Stone);
        CheckBox_ConstructionMaterialFloor5_CastConcrete.setChecked(ConstructionMaterialFloor5_CastConcrete);
        CheckBox_ConstructionMaterialFloor5_Wood.setChecked(ConstructionMaterialFloor5_Wood);
        CheckBox_ConstructionMaterialFloor5_Metal.setChecked(ConstructionMaterialFloor5_Metal);
        CheckBox_ConstructionMaterialFloor5_Other.setChecked(ConstructionMaterialFloor5_Other);
   
    }   
    
    public static boolean stringToBool(String s) {
	  if (s == null || s.equals(""))
  	    return false;
  	  else if (s.equals("0"))
  	    return false;
  	  else if (s.equals("1"))
  		return true;
  	  throw new IllegalArgumentException(s+" is not a bool. Only 1 and 0 are.");
  }
    
} 